package com.jzo2o.customer.controller.worker;


import com.jzo2o.customer.model.dto.request.BankAccountUpsertReqDTO;
import com.jzo2o.customer.model.dto.response.BankAccountResDTO;
import com.jzo2o.customer.service.IBankAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 银行账户 前端控制器
 * </p>
 *
 * @author whx
 * @since 2024-12-02
 */
@RestController
@RequestMapping("/worker/bank-account")
@Api(tags = "服务端-设置银行账户相关接口")
public class BankAccountController {

    @Autowired
    private IBankAccountService bankAccountService;

    @PostMapping
    @ApiOperation("新增或更新银行账户信息")
    public void updateOrInsert(@Valid @RequestBody BankAccountUpsertReqDTO dto){
        bankAccountService.updateOrInsert(dto);
    }

    @GetMapping("/currentUserBankAccount")
    @ApiOperation("获取当前用户银行账户")
    public BankAccountResDTO currentUserBankAccount(){
        return bankAccountService.currentUserBankAccount();
    }

}
